package com.lge.clock.worldclock.map;

import javax.microedition.khronos.opengles.GL10;

/**
 * @author lge.com
 */
public class Background extends Shape{
	private boolean isShowBackground;
	
	private float vertices[] = {
		-1,1,0,		1,1,0,
		-1,-1,0,	1,-1,0,
	};
	private float textures[] = {
		0,0,		0,20,
		20,0,		20,20,
	};
	private short indices[] = {
		0,1,2,		1,2,3,	
	};
	public Background() {
		setVertexBuffer(vertices);
		setTextureBuffer(textures);
		setIndexBuffer(indices);
	}
	@Override
	public void draw(GL10 gl) {
		//Set the face rotation
		gl.glFrontFace(GL10.GL_CW);
		
		gl.glEnable(GL10.GL_TEXTURE_2D);
		
		//Point to our buffer
		gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer);
		gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mTextureBuffer);
		
		//Enable buffer
		gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
		gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
		
		gl.glBindTexture(GL10.GL_TEXTURE_2D, mBindTextures[0]);
		
		gl.glDrawElements(GL10.GL_TRIANGLES, indices.length, GL10.GL_UNSIGNED_SHORT, mIndexBuffer);
		
		//Disable the client state before leaving
		gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
		gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
		
	}
	public boolean isShowBackground() {
		return isShowBackground;
	}
	public void setShowBackground(boolean isShowBackground) {
		this.isShowBackground = isShowBackground;
	}
	
}

